<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no" />
	<title>首页</title>
	<link rel="stylesheet" type="text/css" href="../c/aui.css" />
	<style>
		.aui-card-list,
		.aui-card-list li,
		.aui-card-list ul,
		.aui-list .aui-list-item,
		.aui-list {
			background: none;
			border: 0;
			color: #fff;
		}

		#sx-view .aui-list-item-label-icon {
			color: #fff;
			font-size: 0.75rem;
		}

		#sx-view .aui-list-item-input input {
			color: #fff;
		}

		#sx-view .aui-list-item {
			border-bottom: 1px solid #222
		}

		#sx-view .aui-list-item:active {
			background: none
		}

		.img {
			position: relative;
		}

		.img span {
			position: absolute;
			right: 0;
			top: 0;
			height: 2.2rem;
			line-height: 2.2rem;
			padding: 0 1rem;
			/*border-left: 1px solid #222;*/
		}

		.img span img {
			width: 1.8rem;
			height: 1.8rem;
			display: inline-block;
			vertical-align: middle;
			margin-right: 0.75rem;
		}

		#sx-view .img span i {
			font-size: 0.6rem;
			margin-left: 0.35rem;
		}

		.sx-btn {
			background: #FE2C55;
			width: 80%;
			text-align: center;
			margin: 0 auto;
			padding: 0.55rem 0;
			border-radius: 0.25rem;
			margin-top: 1rem;
			font-size: 0.75rem;
		}

		.content {
			padding: 0.75rem;
			margin-top: 1rem;
			opacity: 0.7
		}

		.content .h2 {
			font-size: 0.75rem;
			padding-bottom: 0.35rem;
		}

		.content p {
			font-size: 0.7rem;
			padding: 0.15rem;
		}
	</style>
</head>

<body>
	<script id="sx-list" type="text/x-dot-template">
		<ul class="aui-list aui-form-list">
			{{? it.pay == 1}}
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-list-item-label-icon">
						真实姓名：
					</div>
					<div class="aui-list-item-input">
						<input type="text" placeholder="填写支付宝真实姓名" id="xingming" value="">
					</div>
				</div>
			</li>
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-list-item-label-icon">
						收款账户：
					</div>
					<div class="aui-list-item-input">
						<input type="text" placeholder="填写支付宝的收款账户" id="zhanghu">
					</div>
				</div>
			</li>
			{{??}}
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-list-item-label-icon">
						微信收款码：
					</div>
					<div class="aui-list-item-input img">
						<input readonly type="text" placeholder="" value="" id="mobile">
						<span tapmode onclick="shangchuan()"><img src="../i/share/session.png" />上传微信收款码<i class="aui-iconfont aui-icon-right"></i></span>
					</div>
				</div>
			</li>
			{{?}}
			<!-- <li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-list-item-label-icon">
						手机号：
					</div>
					<div class="aui-list-item-input mobile">
						<input readonly type="text" placeholder="填写已绑定手机号码" value="15622289461" id="mobile">
						<span tapmode onclick="yzm()">发送验证码</span>
					</div>
				</div>
			</li>
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-list-item-label-icon">
						验证码：
					</div>
					<div class="aui-list-item-input">
						<input readonly type="text" placeholder="填写手机发送的验证码" value="" id="yzm">
					</div>
				</div>
			</li> -->

		</ul>
		<div class="sx-btn" tapmode onclick="add()">安全保存</div>
		<div class="content">
			<div>温馨提示：</div>
			{{? it.pay==1 }}
			<p>1.请确保支付宝已实名认证，并填写支付宝实名认证的真实姓名 <span style="color:#FE2C55;"> (不要填写支付宝昵称)</span></p>
			{{??}}
			<p>1.请确保微信已经实名认证，未实名认证的微信将会转账失败，您的金币会退回账户</p>
			{{?}}
			<p>2.我们承诺不会向任何人透露您的个人信息</p>
			{{? it.pay==2 }}
			<p>3.微信收款二维码操作流程，打开微信APP - 收付款 - 二维码收款 - 保存收款码，上传收款码即可</p>
			{{?}}
		</div>
	</script>
	<div class="aui-content" id="sx-view">
		<div id="loadingdi_huifu" style=" margin-top:50% "><img src="../i/footer_progress.png" /></div>
	</div>
</body>
<script type="text/javascript" src="../j/api.js"></script>
<script type="text/javascript" src="../j/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
	var img = '';
	function urlsa() {
		var imglen = $("img").length;
		var picurls = picurl + "/share";
		for (var i = 0; i < imglen; i++) {
			var tpl = $("img").eq(i).attr("src");
			// console.log(tpl)
			tpls = tpl.replace("../i/share", picurls);
			$("img").eq(i).attr("src", tpls);
	
		}
	}
	apiready = function() {
		urlsa();
		var evalData = doT.template($api.html($api.byId('sx-list')));
		$api.html($api.byId('sx-view'), evalData(api.pageParam));
		api.parseTapmode();
	}
	function add(){
		var xingming = $('#xingming').val();
		var zhanghu = $('#zhanghu').val();
		if(api.pageParam['pay'] == 1){
			if(!xingming){
				document.getElementById("xingming").focus();
				return _msg('请输入支付宝姓名');
			}
			var regName = /^[\u4e00-\u9fa5]{2,4}$/;
	    if (!regName.test(xingming)) {
				_msg('请正确输入您的支付宝姓名');
				document.getElementById("xingming").focus();
				return
	    }
			if(!zhanghu){
				document.getElementById("zhanghu").focus();
				return _msg('请输入支付宝账户');
			}
			_loading();
		}else{
			if(!img){
				return _msg('请上传微信收款码');
			}
		}
		_ajax('member/tixian_band_add',function(ret,err){
			_loadingCloes();
			if(ret){
				if(ret.err){
					_alert(ret.err)
				}else{
					api.execScript({
							name : 'member_tixian',
					    frameName: 'member_tixian',
							script:'tixian_band(\''+JSON.stringify(ret)+'\')'
					})
					_close();
					// console.log(JSON.stringify(ret));
				}
			}else{
				_alert(JSON.stringify(err))
			}
		},{pay:api.pageParam['pay'],img:img,xingming:xingming,zhanghu:zhanghu})
	}

	function shangchuan() {
		api.getPicture({
			sourceType: 'album',
			encodingType: 'jpg',
			mediaValue: 'pic',
			destinationType: 'url',
			allowEdit: false,
			quality: 50,
		}, function(ret, err) {
			console.log(JSON.stringify(ret));
			if (ret) {
				if (ret.data) {
					_loading('正在上传收款码');
					_qiniu(ret.data, function(ret, err) {
						if (ret.status) {
							console.log(JSON.stringify(ret));
							if (ret.oper == "complete") {
								img = ret.info.key;
								add();
							} else if (ret.oper == "progress") {
								//上传过程中获取进度数据
							}
						} else {
							console.log(JSON.stringify(err));
						}
					});
				}
			}
		});
	}
	// 获取
</script>

</html>
